package com.ad.pet.app.account.order;

import android.os.Bundle;
import android.support.design.widget.TabLayout;
import android.support.v4.app.Fragment;
import android.support.v4.view.ViewPager;
import android.view.View;

import com.ad.pet.DaggerMainActivityCompent;
import com.ad.pet.MainActivityCompent;
import com.ad.pet.R;
import com.ad.pet.app.account.order.fragment.InDoorServiceFragment;
import com.ad.pet.app.main.adapter.HomeViewPagerAdapter;
import com.ad.pet.common.data.injector.HasComponent;
import com.ad.pet.common.structure.mvp.BasePresenter;
import com.ad.pet.common.structure.ui.activity.AppToolbarActivity;

import java.util.ArrayList;

import butterknife.BindView;

/**
 * Created by liuyixiang on 2019/10/28.
 */

public class DoorServiceOrderActivity extends AppToolbarActivity implements HasComponent<MainActivityCompent> {
    @BindView(R.id.tab_layout)
    TabLayout mTabLayout;
    @BindView(R.id.viewpager)
    ViewPager mViewpager;
    private MainActivityCompent mMainComponent;

    private ArrayList<Fragment> mFragmentList;
    private ArrayList<String> mList_title;
    private HomeViewPagerAdapter mHomeViewPagerAdapter;
    @Override
    protected void init(Bundle savedInstanceState) {
        super.init(savedInstanceState);
        mStatusLayoutManager.showContent();
        mToolbar.setTitle("上门服务");
    }

    @Override
    protected int contentLayout() {
        return R.layout.activity_order_status;
    }

    @Override
    protected void clickRetry(View v) {

    }

    @Override
    protected void initViews() {
        mFragmentList = new ArrayList<>();
        mList_title = new ArrayList<>();
        mList_title.add(getString(R.string.all));
        mList_title.add(getString(R.string.unpaid));
        mList_title.add(getString(R.string.competed));

        mFragmentList.add(InDoorServiceFragment.newInstance("您还没有相关服务哦"));
        mFragmentList.add(InDoorServiceFragment.newInstance("您还没有相关服务哦"));
        mFragmentList.add(InDoorServiceFragment.newInstance("您还没有相关服务哦"));


        mHomeViewPagerAdapter = new HomeViewPagerAdapter(getSupportFragmentManager());
        mHomeViewPagerAdapter.setData(mFragmentList, mList_title);
        mViewpager.setAdapter(mHomeViewPagerAdapter);
        mTabLayout.setupWithViewPager(mViewpager);//
    }

    @Override
    protected void initData() {

    }

    @Override
    protected void initEvents() {

    }

    @Override
    public void initInject() {
       mMainComponent = DaggerMainActivityCompent.builder().applicationComponent(getApplicationComponent()).activityModule(getActivityModule()).build();
    mMainComponent.inject(this);
    }
    @Override
    public MainActivityCompent getComponent() {
        return mMainComponent;
    }
    @Override
    protected BasePresenter getPresenter() {
        return null;
    }
}
